/* eslint-disable valid-jsdoc */
import request from "@/router/axios";

/**
 * 获取树形数据
 * @param {id} id
 * @returns data
 */
export function getTaskTypeTree(params) {
  return request({
    url: "/task/taskType/tree?portalLoading",
    method: "get",
    headers: {
      "TENANT-ID": params.tenantId
    }
  });
}

/**
 * id获取任务类型数据
 * @param {id} id
 * @returns data
 */
export function getByIdTaskType(query) {
  return request({
    url: "/task/taskType/getById",
    method: "get",
    params: {
      id: query.id
    }
    // headers: {
    //   "TENANT-ID": query.tenantId
    // }
  });
}

/**
 * 保存任务类型数据
 * @param {id} id
 * @returns data
 */
export function saveTaskType(data) {
  return request({
    url: "/task/taskType/save?portalLoading",
    method: "post",
    data
    // headers: {
    //   "TENANT-ID": data.tenantId
    // }
  });
}

/**
 * 通过id删除任务
 * @param {id} id
 * @returns data
 */
export function delTaskType(params) {
  return request({
    url: "/task/taskType/del?portalLoading",
    method: "delete",
    params
    // headers: {
    //   "TENANT-ID": params.tenantId
    // }
  });
}

/**
 * 获取字典值
 * @param {id} id
 * @returns data
 */
export function getDictlist() {
  return request({
    url: "/admin/dict/list",
    method: "get"
  });
}

/**
 * 获取关联属性
 * @param {id} id
 * @returns data
 */
export function getTaskAttrTenant(params) {
  return request({
    url: "/task/taskAttrTenant/list",
    method: "get",
    params
  });
}
